package com.bestcem.xm.txtanls.service;

import com.bestcem.xm.common.core.domain.web.ServiceResult;
import com.bestcem.xm.txtanls.grpc.service.param.analysis.CreateAnalysisProjectParam;
import com.bestcem.xm.txtanls.grpc.service.param.analysis.LinkageUpdateParam;
import com.bestcem.xm.txtanls.grpc.service.param.analysis.ListAnalysisProjectParam;
import com.bestcem.xm.txtanls.grpc.service.param.analysis.UpdateAnalysisProjectParam;
import com.bestcem.xm.txtanls.service.dto.PageResultDTO;
import com.bestcem.xm.txtanls.service.dto.analysis.AnalysisProjectDTO;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 文本分析项目相关业务接口
 *
 * @author XiaoYunSong <ys.xiao@idiaoyan.com>
 * @version v1.0
 * @date 2021/5/8
 */
public interface AnalysisProjectService {
    /**
     * 获取单个文本分析项目
     *
     * @param projectId 项目id
     * @return The analysis project
     * @author XiaoYunSong <ys.xiao@idiaoyan.cn>
     * @date 2021/5/12 18:07
     */
    ServiceResult<AnalysisProjectDTO> getById(String projectId);

    /**
     * 分页获取文本分析项目列表
     *
     * @param param 文本分析列表查询参数
     * @return The analysis project list
     * @author XiaoYunSong <ys.xiao@idiaoyan.cn>
     * @date 2021/5/12 18:07
     */
    ServiceResult<PageResultDTO<AnalysisProjectDTO>> listProject(ListAnalysisProjectParam param);

    /**
     * 创建文本分析项目
     *
     * @param projectParam 文本分析项目初始化参数
     * @return Created Analysis project
     * @author XiaoYunSong <ys.xiao@idiaoyan.cn>
     * @date 2021/5/12 18:07
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    ServiceResult<AnalysisProjectDTO> createProject(CreateAnalysisProjectParam projectParam);

    /**
     * 更新文本分析项目
     *
     * @param projectParam 文本分析项目更新参数
     * @return The updated Analysis project
     * @author XiaoYunSong <ys.xiao@idiaoyan.cn>
     * @date 2021/5/12 18:07
     */
    ServiceResult<AnalysisProjectDTO> updateProject(UpdateAnalysisProjectParam projectParam);

    /**
     * 删除单个文本分析项目
     *
     * @param projectId 项目id
     * @return Deleted analysis project id
     * @author XiaoYunSong <ys.xiao@idiaoyan.cn>
     * @date 2021/5/12 18:07
     */
    ServiceResult<String> deleteProject(String projectId);

    /**
     * 数据源更新联动更新文本分析项目
     *
     * @param param 更新信息
     * @author XiaoYunSong <ys.xiao@idiaoyan.cn>
     * @date 2021/7/15 17:03
     */
    void linkageUpdate(LinkageUpdateParam param);

    void deleteProjectTrainInfo(String projectId);

    void setProjectModelId();
}
